home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
AmigActive 10
/
AACD 10.iso
/
AACD
/
Online
/
SpeakFreely
/
src
/
lpc10
/
median.c
< prev
next >
Wrap
Text File
|
2000-05-18
|
559b
|
31 lines
/**********************************************************************
*
* MEDIAN Version 45G
*
**********************************************************************
*
* Find median of three values
*
* Input:
* D1,D2,D3 - Three input values
* Output:
* MEDIAN - Median value
*/
int median( d1, d2, d3 )
int d1, d2, d3;
{
int the_median;
the_median = d2;
if ( d2 > d1 && d2 > d3 ) {
the_median = d1;
if ( d3 > d1 ) the_median = d3;
}
else if ( d2 < d1 && d2 < d3 ) {
the_median = d1;
if ( d3 < d1 ) the_median = d3;
}
return(the_median);
}